package main

import (
	"fmt"
	"github.com/mitchellh/mapstructure"
)

type Person struct {
	Name   string `mapstructure:"name"`
	Age    int    `mapstructure:"age"`
	Emails []string
	Extra  map[string]string
}

func main() {

	p := Person{
		Name:   "zhangsan",
		Age:    12,
		Emails: []string{"123@qq.com"},
		Extra: map[string]string{
			"a": "a",
			"b": "b",
		},
	}

	output := make(map[string]interface{})
	mapstructure.Decode(p, &output)
	fmt.Println(output)
}
